package com.sky.wsp.sql.scanner.utils;

/**
 * @author wangshaopeng@talkweb.com.cn
 * @desccription 在此输入描述
 * @date 2024/11/16
 */
public class ConfigFileConst {
    /**
     * 源码扫描时，支持的源码文件的扩展名
     */
    public static final String FILE_EXTENTION = "fileExtention.txt";
    /**
     * 源码扫描时，要忽略的文件夹、文件名，例如pom.xml、dist、WEB-INF等
     */
    public static final String IGNORE_FILE_KEYS = "ignoreFileKeys.txt";
    /**
     * 解压Fat jar、war时，lib依赖目录下，要忽略的jar的关键字，例如spring、log4j、mybatis等
     */
    public static final String IGNORE_JAR_KEYS = "ignoreJarKeys.txt";
    /**
     * Mysql与金仓数据库不兼容关键字
     */
    public static final String MYSQL_2_KINGBASE_PATTERN = "mysql2KingbasePattern.txt";
    /**
     * Oracle与金仓数据库不兼容关键字
     */
    public static final String ORACLE_2_KINGBASE_PATTERN = "oracle2KingbasePattern.txt";
    /**
     * Dao.java/Mapper.xml/Php/Python中，SQL方法（增删改查）匹配的关键字，例如@Select、@Query、</select>、Db.select等
     */
    public static final String SQL_PATTERN = "sqlPattern.txt";

    public static String getSqlKeysPattern(String sourceDbType, String targetDbType) {
        sourceDbType = sourceDbType.toLowerCase();
        targetDbType = targetDbType.toLowerCase();
        switch (sourceDbType) {
            case "mysql":
                switch (targetDbType) {
                    case "kingbase":
                        return MYSQL_2_KINGBASE_PATTERN;
                    case "dm":
                    case "vastbase":
                    default:
                        return null;
                }
            case "oracle":
                switch (targetDbType) {
                    case "kingbase":
                        return ORACLE_2_KINGBASE_PATTERN;
                    case "dm":
                    case "vastbase":
                    default:
                        return null;
                }
            default:
                return null;
        }
    }
}
